package com.realbrand.net.realbrandpay.untils;

import com.realbrand.net.realbrandpay.api.HTTPAPI;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2018/1/23.
 */

public class HttpRequest {
    public static <T> T request_BASE_URL(Class<T> serviceClass) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(HTTPAPI.BASE_URL)
                .build();
        return retrofit.create(serviceClass);
    }
    public static <T> T request_BASE_URL_BENDI(Class<T> serviceClass) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(HTTPAPI.BASE_URL_BENDI)
                .build();
        return retrofit.create(serviceClass);
    }
    public static <T> T request_PHOTO_BASEURL(Class<T> serviceClass) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(HTTPAPI.PHOTO_BASEURL)
                .build();
        return retrofit.create(serviceClass);
    }
    public static <T> T request_BASE_URL_VERSION(Class<T> serviceClass,String url) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(url)
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        return retrofit.create(serviceClass);
    }
    public static <T> T request_PAY_BASE_URL(Class<T> serviceClass) {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(HTTPAPI.PAY_BASE_URL)
                .build();
        return retrofit.create(serviceClass);
    }

}
